<style>
.CodeMirror{height:100%;line-height:16px;}
</style>
<script>
function refreshCmsTemplate(){
	$('textarea[name=content]',navTab.getCurrentPanel()).val(cmsTemplateEditor.getValue());
}
</script>
<form method="post" action="cmsTemplate/save.do" class="pageForm required-validate" onsubmit="refreshCmsTemplate();return validateCallback(this, navTabAjaxDone);">
	<div class="formBar">
		<ul>
			<li><a class="button" href="cmsTemplate/delete.do?path=${path}&navTabId=cmsTemplate/list" title="确定要删除该模板吗?" target="ajaxTodo">删除</a></li>
			<li><a class="button" href="cmsTemplate/metadata.html?path=${(path?url)!}" target="ajax" rel="cmsTemplateBox">元数据管理</a></li>
			<li><button type="submit" class="buttonActive">保存</button></li>
		</ul>
	</div>
	<h2 class="contentTitle">
	 	<a class="button" href="cmsTemplate/ftlLookup.html" target="dialog" mask="true">模板片段</a>
	 	<a class="button" href="placeTemplate/lookup.html" target="dialog" mask="true">页面片段</a>
	 	<a class="button" href="cmsWebFile/lookup.html" target="dialog" mask="true">网站文件</a>
	 	<a class="button" href="cmsTemplate/help.html?path=${(path?url)!}" target="dialog" mask="true">模板帮助</a>
	</h2>
	<div class="pageFormContent" layoutH="110">
   		<div>
			<input name="path" type="hidden" value="${path}"/>
			<textarea name="content" id="cmsTemplateEditor"><@_templateContent path=path>${(object)!}</@_templateContent></textarea>
			<script>
				var cmsTemplateEditor = CodeMirror.fromTextArea(document.getElementById('cmsTemplateEditor'), {
			        mode: "freemarkermixed",
			        lineNumbers: true,
			        tabSize        : 4,
			        indentUnit     : 4,
			        lineWrapping   : true,
			        indentWithTabs : true,
			        extraKeys: { "Ctrl-Space": "autocomplete" }
				});
			</script>
		</div>
	</div>
</form>